Can someone make this work? All this address of alias and pointers is still VooDoo to me. I want to associate a declared variable with a Parameter then set the variable by associating the parameter with an actual value. Success is when the final print statement is:
-Louie I'm really after initializing a bunch of variables in my include file based on the values specified for the current project, as defined in a project parameter module. For instance, one project may want a particular link module named "Testing Links", and another project call the same link module "Verification Links". So I'd have a variable "Testing_LMName" which gets set at run time, depending on the current Project running the script. llandale - Fri Mar 28 14:35:02 EDT 2014 |
Re: addr_ of Params Well. You can put a reference to a variable into a Skip easily (common mistake resulting in Skip crashes), but retrieving the reference from the skip is not so easy (because of the references super powers). Therefore I guess the easiest way to get the reference back is to use a pointer (i.e. a reference without 'super powers') to retrieve the reference back from the Skip and assign a new value to it:
Skip skpParams = createString() // I think I need a Skip list to remember the associations
string SSFolder = "" // This is the variable I wish to set
const string cSpecParam = "SpecFolder"
//************************************************
void Associate(string &Variable, Parameter)
{ //Associate the Variable with the Parameter
put (skpParams, Parameter, Variable);
} // end Associate()
//************************************************
void ParamSet(string Parameter, Value)
{ // Set the Variable associated with the Parameter to the Value
string *ref;
if (find(skpParams, Parameter, ref)) { *ref = Value }
} // end ParamSet()
// begin MAIN:
Associate(SSFolder, cSpecParam)
ParamSet (cSpecParam, "SpecFolder Value")
print "<<SSFolder = '" SSFolder "'>>" // should print <<SSFolder = 'SpecFolder Value'>>
Hope this helps, regards, Mathias |
Re: addr_ of Params Mathias Mamsch - Sun Mar 30 18:31:28 EDT 2014 Well. You can put a reference to a variable into a Skip easily (common mistake resulting in Skip crashes), but retrieving the reference from the skip is not so easy (because of the references super powers). Therefore I guess the easiest way to get the reference back is to use a pointer (i.e. a reference without 'super powers') to retrieve the reference back from the Skip and assign a new value to it:
Skip skpParams = createString() // I think I need a Skip list to remember the associations
string SSFolder = "" // This is the variable I wish to set
const string cSpecParam = "SpecFolder"
//************************************************
void Associate(string &Variable, Parameter)
{ //Associate the Variable with the Parameter
put (skpParams, Parameter, Variable);
} // end Associate()
//************************************************
void ParamSet(string Parameter, Value)
{ // Set the Variable associated with the Parameter to the Value
string *ref;
if (find(skpParams, Parameter, ref)) { *ref = Value }
} // end ParamSet()
// begin MAIN:
Associate(SSFolder, cSpecParam)
ParamSet (cSpecParam, "SpecFolder Value")
print "<<SSFolder = '" SSFolder "'>>" // should print <<SSFolder = 'SpecFolder Value'>>
Hope this helps, regards, Mathias That will work thanks. |